package com.vchello.service.impl.user;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.vchello.bean.user.Invitation;
import com.vchello.dao.user.InvitationDao;
import com.vchello.service.user.InvitationService;

/**
 * 
 * @author power
 *
 */
@Service(value = "invitationService")
public class InvitationServiceImpl extends ServiceImpl<InvitationDao, Invitation> implements InvitationService {
	
	@Autowired
	private InvitationDao invitationDao;

	@Override
	public boolean saveInvitation(Invitation entity) {
		return invitationDao.saveInvitation(entity);
	}

	@Override
	public Invitation findInvitationByReceiveId(int receiveId) {
		return invitationDao.findInvitationByReceiveId(receiveId);
	}

	@Override
	public Invitation findInvitation(int inviteId, int receiveId) {
		return invitationDao.findInvitation(inviteId, receiveId);
	}

	@Override
	public boolean deleteInvitation(Invitation entity) {
		try {
			invitationDao.deleteInvitation(entity);
			return true;
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}
	}

	@Override
	public Invitation findInvitationByCode(String code) {
		return invitationDao.findInvitationByCode(code);
	}

	@Override
	public boolean updateInvitation(Invitation entity) {
		return invitationDao.updateInvitation(entity);
	}

	
}
